Socket
Socket
Sign inDemoInstall

d3-scale-chromatic

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-scale-chromatic

Sequential, diverging and categorical color schemes.


Version published
Weekly downloads
2.6M
decreased by-12.76%
Maintainers
2
Weekly downloads
 
Created

What is d3-scale-chromatic?

The d3-scale-chromatic package provides color schemes designed to work with d3-scale's sequential, diverging, and categorical color scales. It includes a variety of color palettes that can be used for data visualization, such as for mapping data values to colors in charts and graphs.

What are d3-scale-chromatic's main functionalities?

Sequential Color Schemes

Sequential color schemes are ideal for displaying ordered data that progresses from low to high. The package provides a variety of single-hue and multi-hue color schemes.

import { scaleSequential } from 'd3-scale';
import { interpolateBlues } from 'd3-scale-chromatic';

const colorScale = scaleSequential(interpolateBlues).domain([0, 100]);
console.log(colorScale(50)); // Outputs a color from the 'Blues' sequential color scheme

Diverging Color Schemes

Diverging color schemes are used to visualize data that diverges from a median value, with contrasting colors on either side. This is useful for highlighting deviation from a midpoint.

import { scaleDiverging } from 'd3-scale';
import { interpolatePiYG } from 'd3-scale-chromatic';

const colorScale = scaleDiverging(interpolatePiYG).domain([0, 50, 100]);
console.log(colorScale(50)); // Outputs the middle color from the 'PiYG' diverging color scheme

Categorical Color Schemes

Categorical color schemes are used for discrete data that falls into distinct categories. The package provides several categorical color palettes with a fixed number of colors.

import { scaleOrdinal } from 'd3-scale';
import { schemeCategory10 } from 'd3-scale-chromatic';

const colorScale = scaleOrdinal(schemeCategory10);
console.log(colorScale('category1')); // Outputs a color from the 'Category10' categorical color scheme

Other packages similar to d3-scale-chromatic

Keywords

FAQs

Package last updated on 23 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc